package com.src.myapplication.ui.view.fragmentpemgyou;

import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.google.gson.Gson;
import com.src.myapplication.R;
import com.src.myapplication.base.BaseFragmentSwp;
import com.src.myapplication.bean.PengYouQuanben;
import com.src.myapplication.config.UrlConfig;
import com.src.myapplication.widget.CommonAdapter;
import com.src.myapplication.widget.base.ViewHolder;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/10/17.
 */
public class FrgmentPengYouQuan extends BaseFragmentSwp {


    private RecyclerView mRcv;

    @Override
    protected void initData(View view) {
        mRcv = (RecyclerView) view.findViewById(R.id.rcv);
    }



    @Override
    public int getLayoutId() {
        return R.layout.fragment_pengyouquan;
    }

    @Override
    public int getid() {
        return R.id.sw;
    }

    @Override
    public String geturl() {
        return UrlConfig.PengYou.PENGYOU_PENGOUQUAN;
    }

    @Override
    public Class<? extends Object> getben() {
        return PengYouQuanben.class;
    }


    @Override
    public void addList(String string) {
        if (string != null) {
            Gson gson = new Gson();
            List<PengYouQuanben> list = new ArrayList<>();
            PengYouQuanben paiHangBangben = gson.fromJson(string, PengYouQuanben.class);
            list.add(paiHangBangben);
            CommonAdapter<PengYouQuanben> adapter = new CommonAdapter<PengYouQuanben>(getContext(), R.layout.xiaoxi_paihang_list, list) {
                @Override
                protected void convert(ViewHolder holder, PengYouQuanben paiHangBangben, int position) {

                }
            };
            mRcv.setAdapter(adapter);
        }

    }


    @Override
    public void showLoadFailMsg() {

    }
}